package com.carbon.system.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.carbon.common.service.BaseServiceImpl;
import com.carbon.domain.system.vo.param.ChangePasswordParam;
import com.carbon.system.entity.SysAccount;
import com.carbon.system.mapper.SysAccountMapper;
import com.carbon.system.param.BindEmailParam;
import com.carbon.system.param.ChangePhoneParam;
import com.carbon.system.param.SysAccountQueryParam;
import com.carbon.system.service.SysAccountService;
import com.carbon.system.vo.SysAccountQueryVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


/**
 * <p>
 * 帐号  服务实现类
 * </p>
 *
 * @author Li Jun
 * @since 2021-06-11
 */
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class SysAccountServiceImpl extends BaseServiceImpl<SysAccountMapper, SysAccount> implements SysAccountService {
    @Autowired
    SysAccountMapper sysAccountMapper;

    @Override
    public String transactionex(String buyerDeliveryExchange) {
        return sysAccountMapper.transactionex(buyerDeliveryExchange);
    }
    @Override
    public String transactionNumberToChinese(String projectType) {
        return sysAccountMapper.transactionNumberToChinese(projectType);
    }
    @Override
    public SysAccount getInfoById(Integer userId) {
        return sysAccountMapper.getInfoById(userId);
    }

    @Override
    public Integer updatePassword(ChangePasswordParam changePasswordParam) {

        return sysAccountMapper.updatePassword(changePasswordParam);
    }

    @Override
    public Integer updateEmail(BindEmailParam bindEmailParam) {
        return sysAccountMapper.updateEmail(bindEmailParam);
    }

    @Override
    public Integer updatePhone(ChangePhoneParam changePhoneParam) {
        return sysAccountMapper.updatePhone(changePhoneParam);
    }

    @Override
    public IPage<SysAccountQueryVo> search(Page<SysAccountQueryVo> page, SysAccountQueryParam param) {
        return sysAccountMapper.search(page,param);
    }

    @Override
    public void saveRoleToAccount(Long id, String roleNames) {
        sysAccountMapper.saveRoleToAccount(id,roleNames);
    }

    @Override
    public void removeOtherByAccountId(String id) {
        sysAccountMapper.removeOtherByAccountId(id);
    }

    @Override
    public String transactionexB(String accountStatus) {
        return sysAccountMapper.transactionexB(accountStatus);
    }

    @Override
    public String transactionexC(String status) {
        return sysAccountMapper.transactionexC(status);

    }


}
